package main.java.indi.zyj.hot100;

public class _04_maxArea {
    public int maxArea(int[] height) {

        int i = 0, j = height.length - 1;
        int max = 0;

        while (i != j){

            max = Math.max(max, Math.min(height[i], height[j]) * (j - i));

            if (height[i] <= height[j]){
                i++;
            }else {
                j--;
            }
        }
        return max;

    }
}
